Skip to content

Wormav/Push_swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Push_swap

c

Projet

The Push_swap project is part of the curriculum at 42, designed to test a student’s ability to manipulate stacks, implement efficient sorting algorithms, and manage constraints such as memory usage and execution time.

Objective

The goal of the project is to sort a list of integers using only a predefined set of operations on two stacks, a and b. The challenge lies in sorting the numbers with the fewest possible moves, demonstrating algorithmic efficiency.

Operations

he allowed operations are:

• sa: Swap the first two elements of stack a.
• sb: Swap the first two elements of stack b.
• ss: Perform both sa and sb at the same time.
• pa: Push the top element from stack b to stack a.
• pb: Push the top element from stack a to stack b.
• ra: Rotate stack a (shift all elements upwards, and the top becomes the last).
• rb: Rotate stack b.
• rr: Perform both ra and rb at the same time.
• rra: Reverse rotate stack a (shift all elements downwards, and the last becomes the top).
• rrb: Reverse rotate stack b.
• rrr: Perform both rra and rrb at the same time.

License

MIT License Copyright (c) 2024 Jérémy Lorette

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published