Skip to content

Assemby program that takes array of numbers from the user, sorts it with one of the three simple algorithms (depending on the user desire) and prints the sorted array.

Notifications You must be signed in to change notification settings

MinaAashraf/Array-Sorting

Repository files navigation

Sorted Array

  • Project Summary:

    An Assembly program that takes array of numbers from the user, sorts it with one of the three simple algorithms: Bubble Sort, Selection Sort, Insertion Sort (depending on the user desire) and prints the sorted array.

  • Project Advantages:

    • Three types of sorting algorithms.
    • Choosing the method of sorting is based on the user desire.
    • The number of values is variable and determined by the user.
    • Handling for inputs such that the user can only enters integers.
    • The numbers can be sorted ascending or descending.

  • Project Contributers:

    Name Role Branch
    1. Mostafa Mahmoud Mostafa Handling Input validation and representation Input_branch
    2. Mohamed Ali Mohamed Creating Bubble sort algorithm Bubble_Sort
    3. Mohamed Hani Abo Elela Creating Insertion Sort algorithm Insertion_Sort
    4. Mahmoud Mohamed Abdelwahab Creating Selection sort algorithm selection_sort
    5. Mina Ashraf Fakhry Handling output after Sorting master

  • Project Language:

    Assembly Programming Language.


  • Project Description:

    This project is a program takes a set of numbers from user to sort them ascending or descending based upon the desire of the user. firstly the program asks the user to enter the number of elements, then the program asks him to enter the values of numbers. then the program asks the user to choose the sorting method because the program supports three ways of sorting (Bubble Sort - Selection Sort - Insertion Sort).

    • Bubble Sort Algorithm:

      • Idea:

        it works by repeatedly swapping the adjacent elements if they are in wrong order.

        image

      • Example:

        image

        image

        image

        image

      • Java Code for the Bubble Sort algorithm:

        Bubble sort

      • Time Complexity:

        Time Complexity is O(n^2).


    • Selection Sort Algorithm:

      • Idea:

        sorts an array by repeatedly finding the maximum element (considering ascending order) from unsorted part and putting it at the ending.

      • Example:

        1

      • Java Code for the algorithm:

        code

      • Time Complexity:

        Time Complexity is O(n^2).


    • Insertion Sort Algorithm:

      • Idea:

        In this sorting technique, we pick an element and then insert it in the appropriate position in ascending or descending order.

      • Example:

        1

        In pass 1, element arr[1] is inserted before arr[0], so that arr[0] and arr[1] are sorted.

        2

        In pass 2, element arr[2] is inserted before arr[0] or between arr[0] and arr[1] or after arr[1], so that arr[0], arr[1] and arr[2] are sorted.

        3

        4

        In a similar way the process is carried out n-1 times.

      • Java Code for the algorithm:

        javacode

      • Time Complexity:

        Time Complexity is O(n^2).


  • Project Testing:

    This is a video for testing the Project:

    Sorting Algorithm Project


  • Project Tools:

    • Visual studio IDE.
    • MASM.

  • External Library:

    • Irvine32.lib


  • Issues:

    • Irvine32 library handles input using function called ReadInt and in this function he takes the input as string then calls for another function called ParseInteger32 in this function he takes each digit as token so he takes the longest decimal number possible from the string and if the length of input string is 0 he assigns the EAX register with 0.

    • So if the user presses Enter in an input that accepts 0 as input i am forced to take it as valid input.

    • When the input is partially valid as the number has character in it Irvine gives me the longest valid number as previously stated and again i am forced to take the input as valid input.

About

Assemby program that takes array of numbers from the user, sorts it with one of the three simple algorithms (depending on the user desire) and prints the sorted array.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published