Question: I need help to Redo the insertion sort algorithm so that the values are inserted into a linked list rather than an array. This eliminates
I need help to Redo the insertion sort algorithm so that the values are inserted into a linked list rather than an array. This eliminates the need to move other values when a new value is inserted, since your algorithm can simply insert a new node where the new value should go. Code your algorithm to produce a complete C++ program that reads in a list of 10 integers, sort the integers, and then writes out the sorted list. Your program should allow the user to repeat the process and sort another list until the user says he or she wants to exit the program. the code is below
#include
#include
enum SourceType {Legal, Vacant, Removed};
struct HashNodeTaken { int entity; enum SourceType data; };
struct HashTable { int size; HashNodeTaken *table; };
int Hashfunction1(int key_value, int size) { return key_value % size; }
int Hashfunction2(int key_value, int size) { return (key_value * size - 1) % size; }
HashTable *startTable(int size) { HashTable *htable; if (size < MINIMUM_TABLE_SIZE) { cout<<"Table Size Too Small.Please Check"<
HashTable *rehashing(HashTable *htable) { int size = htable->size; HashNodeTaken *table = htable->table; htable = startTable(2 * size); for (int i = 0; i < size; i++) { if (table[i].data == Legal) push(table[i].entity, htable); } free(table); return htable; }
void getdata(HashTable *htable) { for (int i = 0; i < htable->size; i++) { int value = htable->table[i].entity; if (!value) cout<<"position: "<
}
int main() { int value, size, position, i = 1; int select; HashTable *htable; while(1) {
cout<<"Functions in Double Hashing"<
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
