/push_swap

puuush_swappp

Primary LanguageC

Push_swap

Foreword

Whether you’re familiar with sorting algorithms or just stepping into the world of data manipulation, the Push_swap project offers a fascinating journey into the realm of algorithmic optimization. This project challenges you to sort data on a stack using a limited set of instructions while aiming to minimize the number of actions required. Get ready to delve deep into the world of sorting algorithms and discover the beauty of efficiency.

Introduction

Push_swap is a project designed to test your ability to sort data efficiently. You’ll be given a stack of integers and a set of instructions to manipulate the stack. Your task is to write a program that generates the smallest sequence of instructions needed to sort the integers in ascending order. It may sound simple, but the devil is in the details.

Objectives

Sorting algorithms are fundamental to programming and are often a topic of discussion in job interviews. By completing this project, you’ll gain a deeper understanding of algorithm complexity and learn how to choose the most efficient sorting solution for different scenarios. This project emphasizes rigor, C programming skills, and algorithmic complexity.

Common Instructions

  • Your project must be implemented in C.
  • Adherence to the Norm is essential. Ensure your code meets the specified guidelines, including error handling and memory management.
  • Provide a Makefile for compiling your source files with appropriate flags.
  • Submission should include all necessary files, including header files, source files, and any additional resources.
  • Encouraged to create test programs to ensure the correctness and robustness of your implementation.

Mandatory Part

Program Name

push_swap

Turn in Files

Makefile, *.h, *.c

Makefile

  • NAME, all, clean, fclean, re

Arguments

A list of integers representing the initial stack configuration.

External Functions

  • read, write, malloc, free, exit
  • ft_printf or equivalent

Libft Authorized

Yes

Description

Create a program that generates the smallest sequence of instructions to sort a stack of integers in ascending order.

Rules

  • You have two stacks named a and b.
  • Stack a contains a random amount of integers, with no duplicates.
  • Stack b is initially empty.
  • Use provided instructions to manipulate the stacks and sort the integers in stack a.
  • The goal is to sort the integers in stack a with the fewest number of operations possible.

Bonus Part

While the focus of this project is on the mandatory requirements, you can implement additional features to enhance your project. However, the bonus part will only be assessed if the mandatory part is perfect.

Submission and Peer-Evaluation

Submit your completed assignment to your assigned Git repository following the provided instructions. Only the work within the Git repository will be evaluated during the defense. Ensure all files are correctly named and organized before submission.