Git Product home page Git Product logo

push_swap's Introduction

# **************************************************************************** #
#                                                                              #
#                                                         :::      ::::::::    #
#    push_swap                                          :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: aachhoub <[email protected]>        +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2023/02/02      by aachhoub              #+#    #+#              #
#    Updated: 2023/02/02      by aachhoub             ###   ########.fr        #
#                                                                              #
# **************************************************************************** #

push_swap

This project requires you to sort data on a stack using a limited set of instructions and with the fewest possible moves. To accomplish this task, you will need to manipulate different sorting algorithms and select the optimal solution(s) for efficient data sorting.

Functions:

  • is_sorted: Checks if a stack is sorted or not.
  • tiny_sort: Uses the minimum instructions to sort a stack that has three nodes
  • push_and_save_three: Pushes all nodes from stack_a to stack_b except 3 nodes amongs the greter half of stack_a
  • sort: Sorts stack_a using an algorithms depending on the size of stack_a
  • get_cost: Gets the count of moves that a node requires in order to be moved to the head of a stack
  • cheapest_move: Decides which set of moves are suitable for a node in order to move it to the top of stack
  • lowest_index_position: Returns the index of the greater node in a stack (which also had the lowest index)
  • target_position: Assign the target position to all nodes
  • move: Performes a set of consecutive instructios to move a node to the head of a stack
  • fill_stack: Fills the stack_a
  • assign_index: Assigns an index to all nodes of stack_a from the greatest to the lowest
  • ft_stack_bottom: Returns the last node of a stack
  • ft_stack_before_bottom: Return the node before the last one of a stack
  • stack_new: Creates a new node
  • ft_stack_size: Returns the count of nodes in a stack
  • ft_stack_add_back: Adds a new node to the back of a stack
  • free_stack: Frees all allocated memory for nodes of a stack
  • exit_error: Exit and desplay an error message
  • valid_input: Checks if the input is valid
  • do_oper_a (bonus): Performs a specific instruction on stack_a
  • do_oper_b (bonus): Performs a specific instruction on stack_b

! Please note that the functions listed above are not an exhaustive list of all the functions available. I have created numerous other functions in previous projects that may also be useful, but they are not included in the list above.

Author

Abdo Achhoubi

push_swap's People

Contributors

abdoachhoubi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.