Decompose algorithms in commutator notation.

Overview

Commutator

Decompose algorithms in commutator notation.

Let be any group. If , then the commutator of and is the element . The expression denotes the conjugate of by , defined as . Therefore, means .

In this repository, we assume that is a free group.

In mathematics, the free group over a given set consists of all words that can be built from members of , considering two words to be different unless their equality follows from the group axioms (e.g. , but for ). The members of are called generators of , and the number of generators is the rank of the free group. An arbitrary group is called free if it is isomorphic to for some subset of , that is, if there is a subset of such that every element of can be written in exactly one way as a product of finitely many elements of and their inverses (disregarding trivial variations such as ).

It is worth researching since many 3-cycle formulas in a Rubik's cube can be written as commutators.

Currently, the time complexity of this algorithm is . It is still unknown if there is a faster algorithm or if this algorithm can detect all possible commutators.

If you have a better algorithm, please let me know. Thank you.

Example 1:

Input: s = "R U R' U'"
Output: "[R,U]"

Example 2:

Input: s = "a b c a' b' c'"
Output: "[a b,c b]"
Explanation: a b + c b + b' a' + b' c' = a b c a' b' c'.
And "[a c',c b]" is also a valid answer.

Example 3:

Input: s = "D F' R U' R' D' R D U R' F R D' R'"
Output: "D:[F' R U' R',D' R D R']"
And "[D F' R U' R' D',R D R' D']" is also a valid answer.

Example 4:

Input: s = "R' F' R D' R D R2 F2 R2 D' R' D R' F' R"
Output: "R' F':[R D' R D R2,F2]"

Example 5:

Input: s = "R U R'"
Output: "Not found."

Constraints:

  • s consist of only English letters.
You might also like...

Path-finding & Sorting algorithms Visualizer

Update - Changelog 📋 09.05.2022 AlgoVision is now fully mobile-responsive for all its features ! On mobile, the 'Mouse Chase' option in Dynamic Mode

Dec 18, 2022

For some realizations of the title and thinking of the book Introduction to Algorithms, if there is something wrong, please correct me.

Introduction-to-Algorithms Introduce Origin of this library Some implementations of the topics in Introduction to Algorithms and some reflections on t

Jun 9, 2022

FrontEnd Master algorithms!

next-course-starter A NextJS starter to get you started creating educational materials using Markdown Get Started Set up Node.js v14+ Clone this repo

Dec 18, 2022

Ace your next Javascript coding interview by mastering data structures and algorithms.

The Coding Interview: Algorithms + Data Structures Ace your next Javascript coding interview by mastering data structures and algorithms. Problem 1: S

Sep 19, 2022

Notes, challenge resolutions, and applications of the Grokking Algorithms book content with unit tests

Notes, challenge resolutions, and applications of the Grokking Algorithms book content with unit tests

Grokking Algorithms Statements Branches Functions Lines Notes, challenge resolutions, and applications of the Grokking Algorithms book content Index F

Aug 14, 2022

Science! Testing various image matching algorithms' performance on the Pinecone vector DB

Image Matching Algorithms For Use With KNN Search As part of the development of alt-text.org, it's necessary to perform large-scale fuzzy matching of

Sep 3, 2022

Implementing various sorting algorithms in Typescript's type system

Implementing various sorting algorithms in Typescript's type system

Sorta Cool I was on a 10 hour flight with no WiFi, and, bored out of my mind, I thought it would be fun to implement some sorting algorithms in the Ty

Nov 10, 2022

A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YAML support designed to be easy to set up and use

A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YAML support designed to be easy to set up and use

About A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YML

Dec 28, 2022

It will be contain many algorithms about js for job interviews.

Algortihms with Javascript 📌 📗 TR: Bu projenin temel amacı, işe girerken yapılan mülakatlar için bizlere sunulan algoritma soruları ve çözümlerini i

Dec 3, 2022
Comments
  • Sort decompositions according to length

    Sort decompositions according to length

    The various decompositions that are generated for the algorithm are of varying lengths.

    Most of the time, the shortest decomposition is at the top, but that is usually not the case.

    It would be preferable if the decompositions are sorted according to their string length (including brackets).

    opened by abunickabhi 4
  • Outer bracket for commutators

    Outer bracket for commutators

    Currently the algs are decomposed as A:[B,C].

    It would be convenient if it is decomposed as [A:[B,C]] so that it is easy to enter into the alg.cubing.net site.

    opened by abunickabhi 3
  • Alg and its inverse give different decomposition

    Alg and its inverse give different decomposition

    For cases which can have multiple decompositions,

    The alg U R' S' R E R E' R' S' U' R' S2 R gives the decomposition [U:[R',S' R E][S2,U' R']],

    whereas the inverse of it, R' S2 R U S R E R' E' R' S R U' gives the decomposition [R':[S2,R U][R U:[S' R E,R']]].

    How to make the alg and its inverse decomposition consistent?

    opened by abunickabhi 1
Type Safe Object Notation & Validation

tson Type Safe Object Notation & Validation ?? Work in Progress, not ready for production... Features ?? Functional ?? Immutable ✅ Well tested Why? Af

null 9 Aug 10, 2022
A lightweight (~850 B) library for easy mac/window shortcut notation. kbd-txt convert shortcut text depending on the type of OS (window/linux/mac).

kbd-txt A lightweight (~850 B) library for easy mac/window shortcut notation. kbd-txt convert shortcut text depending on the type of OS (window/linux/

Minung Han 6 Jan 1, 2023
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

?? Algorithms and data structures implemented in JavaScript with explanations and links to further readings

Oleksii Trekhleb 157.8k Dec 29, 2022
:fireworks:Interactive Online Platform that Visualizes Algorithms from Code

Algorithm Visualizer Algorithm Visualizer is an interactive online platform that visualizes algorithms from code. Learning an algorithm gets much easi

Algorithm Visualizer 42k Jan 4, 2023
🥞Data Structures and Algorithms explained and implemented in JavaScript + eBook

Data Structures and Algorithms in JavaScript This is the coding implementations of the DSA.js book and the repo for the NPM package. In this repositor

Adrian Mejia 7k Jan 4, 2023
Bringing an all Open-Source Platform to study Data Structures and Algorithms ⚡

NeoAlgo-Docs Bringing an all Open-Source Platform to study Data Structures and Algorithms ⚡ ?? Installation You will need to have NodeJS and Yarn inst

Tesseract Coding 24 Jun 2, 2022
Venni backend - The backend of the Venni client apps implementing the credit card payments, matching algorithms, bank transfers, trip rating system, and more.

Cloud Functions Description This repository contains the cloud functions used in the Firebase backend of the Venni apps. Local Development Setup For t

Abrantes 1 Jan 3, 2022
Data structures & algorithms implementations and coding problem solutions. Written in Typescript and tested with Jest. Coding problems are pulled from LeetCode and Daily Coding Problem.

technical-interview-prep Data structures & algorithms implementations and coding problem solutions. Written in Typescript and tested with Jest. Coding

Lesley Chang 7 Aug 5, 2022
A Typescript companion to the book A Common-Sense Guide to Data Structures and Algorithms by Jay Wengrow

This repository aims to be a companion to the book A Common-Sense Guide to Data Structures and Algorithms by Jay Wengrow. I rewrote most of the data s

Alexandre Lim 29 Dec 3, 2022
Sorting visualizer to introduce students to different sorting algorithms, how they work, and how to apply them

sorting-visualizer Sorting visualizer to introduce students to different sorting algorithms, how they work, and how to apply them Iteration 1 Demo: ht

Aditya Malik 1 Nov 14, 2022