CS-201-Assignment-3

DataStructures
Course Code: CS 201
National Institute of Technology, Silchar

Submitted by-
Abhigyan Ballav Baruah
2012133
CSE Sec-B

Questions:

  1. How to generate unique string hash value? For instance, input: ”CSE Rocks”, Output: Some integer value
  2. Benchmark the performance of Insertion sort technique for average case, best case and worst cases. Draw the chart.
  3. Write a program to generate a set of prime numbers using Sieve of Eratosthenes. Input range n = 2^64-1.
  4. Write a program to create library for the array A[] of size n of the following functions
    a. InsertItemAtLast(int A[], int n, int key), return void
    b. InsertItemAtFirst(int A[], int n, int key), return void
    c. InsertItemAtIndex(int A[], int n, int i, int key), return void
    d. DeleteItemFromLast(int A[], int n, int key), return void
    e. DeleteItemfromFirst(int A[], int n, int key), return void
    f. DeleteItemFromIndex(int A[], int n, int i, int key), return void
    g. FindItemUnsorted(int A[], int n, int key), return index
    h. FindItemSorted(int A[], int n, int key), return index
    i. SortArray(int A[], int n), return void
    j. ExtractSubest(int A[], int n, int i, int j), return new array
    k. DeleteSubset(int A[], int n, int i, int j), return void
    l. SplitIntoTwoArray(int A[], int n), return new subarray
    m. CloneArray(int A[], int n, int B[]), return new subarray
    n. ShiftLeftArray(int A[], int n, int r), return void
    o. ShiftRightArray(int A[], int n, int r), return void
    p. RotateArrayClockwise(int A[], int n, int r), return void
    q. RotateArrayAntiClockwise(int A[], int n, int r), return void
    r. FindMin(int A[], int n), return index
    s. FindMax(int A[], int n), return index
    t. FillArrayPseudoRandom(int A[], int n), return void
    u. FillArrayTrueRandom(int A[], int n), return void
    v. IncreaseArraySize(int A[], int n, int m), return new array
    w. SetArrayToZero(int A[], int n), returns void
    x. DeleteAllItemOfArray(int A[], int n), returns void
    y. DeleteArray(int A[], int n), returns void
    z. AllocateArray(int A[], int n), returns address
    where i, and j are index, key is to be searched/inserted/deleted, r is the total number of rotations/shifting.