DFS File New
DFS File New
4 Selection Sort
5 Insertion Sort
6 Bubble Sort
7 Merge Sort
8 Quick Sort
9 Count Sort
10 Radix Sort
Delete Node from Beginning, End, and Given Position in a Singly Linked
11
List
Insert Node from Beginning, End, and Given Position in a Singly Linked
12
List
13 Binary Tree Operations and Traversals
17 Trie Implementation
19 Heap Sort
#include <stdio.h>
int main() {
int arr[] = {10, 20, 30, 40, 50};
int n = sizeof(arr) / sizeof(arr[0]); int key =
30;
return 0;
}
2. Binary Search
#include <stdio.h>
int binarySearch(int arr[], int left, int right, int key) { while
(left <= right) {
int mid = left + (right - left) / 2;
if (arr[mid] == key)
return mid;
else if (arr[mid] < key) left
= mid + 1;
else
right = mid - 1;
}
return -1;
}
int main() {
int arr[] = {10, 20, 30, 40, 50};
int n = sizeof(arr) / sizeof(arr[0]); int key =
30;
(result != -1)
printf("Element found at index %d\n", result);
else
printf("Element not found\n");
return 0;
}
SIZE 3
void multiplyMatrices(int A[SIZE][SIZE], int B[SIZE][SIZE], int result[SIZE][SIZE]) { for (int i = 0; i <
SIZE; i++) {
for (int j = 0; j < SIZE; j++) { result[i][j] =
0;
for (int k = 0; k < SIZE; k++) {
result[i][j] += A[i][k] * B[k][j];
}
}
}
}
void printMatrix(int matrix[SIZE][SIZE]) { for (int i
= 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) { printf("%d ",
matrix[i][j]);
}
printf("\n");
}
}
int main() {
int A[SIZE][SIZE] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 6}};
int B[SIZE][SIZE] = {{3, 2, 1}, {6, 5, 4}, {6, 8, 7}};
int result[SIZE][SIZE];
multiplyMatrices(A, B, result);
printf("Product of matrices:\n");
printMatrix(result);
return 0;
}
4. Selection Sort
#include <stdio.h>
int main() {
int arr[] = {64, 25, 12, 22, 11};
int n = sizeof(arr) / sizeof(arr[0]);
selectionSort(arr, n);
return 0;
}
5. Insertion Sort
#include <stdio.h>
void insertionSort(int arr[], int n) { for (int i = 1; i < n; i++) { int key =
arr[i]; int j = i - 1;
int main() {
int arr[] = {5, 85, 45, 27, 33};
int n = sizeof(arr) / sizeof(arr[0]); insertionSort(arr, n);
printf("Sorted array: "); printArray(arr, n);
return 0;
}
6. Bubble Sort
#include <stdio.h>
int main() {
int arr[] = {4,3,15,7,2};
int n = sizeof(arr) / sizeof(arr[0]);
bubbleSort(arr, n);
return 0;
}
7. Merge Sort
#include <stdio.h>
void merge(int arr[], int left, int mid, int right) { int n1 = mid
- left + 1;
int n2 = right - mid; int
L[n1], R[n2];
int main() {
int arr[] = {21,6,15,5,6,20};
int n = sizeof(arr) / sizeof(arr[0]);
mergeSort(arr, 0, n - 1);
return 0;
}
8. Quick Sort
#include <stdio.h>
return (i + 1);
}
int main() {
int arr[] = {7, 4, 15, 2, 6, 11};
int n = sizeof(arr) / sizeof(arr[0]);
quickSort(arr, 0, n - 1);
return 0;
}
G. Count Sort
#include <stdio.h>
int index = 0;
for (int i = 0; i <= max; i++) { while
(count[i] > 0) {
arr[index++] = i;
count[i]--;
}
}
}
int main() {
int arr[] = {8,5,5,4,6,3,3,10};
int n = sizeof(arr) / sizeof(arr[0]);
countingSort(arr, n);
return 0;
}
10. Radix Sort
#include <stdio.h>
int main() {
int arr[] = {276, 38, 7, 46, 5, 646, 3, 77};
int n = sizeof(arr) / sizeof(arr[0]);
radixSort(arr, n);
return 0;
}
11. Delete Node from Beginning, End, and Given Position in a Singly Linked List
struct Node {
int data;
struct Node* next;
};
if ((*head)->next == NULL) {
free(*head);
*head = NULL;
return;
}
free(temp->next);
temp->next = NULL;
}
if (pos == 1) {
deleteFromBeginning(head); return;
}
int main() {
struct Node* head = NULL;
insertEnd(shead, 10);
insertEnd(shead, 20);
insertEnd(shead, 30);
insertEnd(shead, 40);
deleteFromBeginning(shead); printf("After
deleting from beginning: ");
display(head);
deleteFromEnd(shead); printf("After
deleting from end: "); display(head);
return 0;
}
12. Insert Node from Beginning, End, and Given Position in a Singly Linked List
struct Node {
int data;
struct Node* next;
};
if (*head == NULL) {
*head = newNode;
return;
}
void insertAtPosition(struct Node** head, int val, int pos) { if (pos < 1)
return;
if (pos == 1) { insertAtBeginning(head,
val); return;
}
if (!temp) return;
int main() {
struct Node* head = NULL;
insertAtEnd(shead, 20);
insertAtEnd(shead, 30); printf("Initial
List: ");
display(head);
return 0;
}
struct Node {
int data;
struct Node* left;
struct Node* right;
};
struct Queue {
struct Node** array; int
front;
int rear;
int capacity;
};
struct Stack {
struct Node** array; int
top;
int capacity;
};
if (*root == NULL) {
*root = newNode;
return;
}
while (!isQueueEmpty(q)) {
struct Node* temp = dequeue(q);
if (temp->left == NULL) {
temp->left = newNode;
return;
} else {
enqueue(q, temp->left);
}
if (temp->right == NULL) {
temp->right = newNode;
return;
} else {
enqueue(q, temp->right);
}
}
}
while (!isStackEmpty(s)) {
struct Node* temp = pop(s);
printf("%d ", temp->data);
temp = pop(s);
printf("%d ", temp->data);
temp = temp->right;
}
}
while (!isStackEmpty(s2)) {
printf("%d ", pop(s2)->data);
}
}
while (!isQueueEmpty(q)) {
struct Node* temp = dequeue(q);
printf("%d ", temp->data);
int main() {
struct Node* root = NULL;
insert(sroot, 1);
insert(sroot, 2);
insert(sroot, 3);
insert(sroot, 4);
insert(sroot, 5);
insert(sroot, 6);
insert(sroot, 7);
printf("\n");
printf("Level-order: ");
levelOrder(root);
printf("\n");
return 0;
}
14. Binary Search Tree (BST) Operations
Objective: Implement insertion, deletion, search, and traversal in a BST.
Tasks:
Insert: Follow BST properties.
Delete: Handle cases for 0, 1, or 2 children.
Search: Return True/False if a value exists.
Inorder Traversal: Output sorted elements.
struct Node {
int data;
struct Node* left;
struct Node* right;
};
return root;
}
return root;
}
int main() {
struct Node* root = NULL;
insert(root, 40);
insert(root, 60);
insert(root, 80);
return 0;
}
15. AVL Tree Insertion and Deletion
Objective: Maintain balance during insertion/deletion using rotations.
Tasks:
Insert: Apply LL, RR, LR, RL rotations as needed.
Delete: Rebalance the tree post-deletion.
Print Level-order after each operation.
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node* left;
struct Node* right;
int height;
};
x->right = y;
y->left = T2;
return x;
}
y->left = x;
x->right = T2;
return y;
}
balance = getBalance(node);
// LL
if (balance > 1 ss key < node->left->data)
return rightRotate(node);
// RR
if (balance < -1 ss key > node->right->data) return
leftRotate(node);
// LR
if (balance > 1 ss key > node->left->data)
{ node->left = leftRotate(node->left); return
rightRotate(node);
}
// RL
if (balance < -1 ss key < node->right->data) { node-
>right = rightRotate(node->right); return
leftRotate(node);
}
return node;
}
free(temp);
} else {
struct Node* temp = minValueNode(root->right); root-
>data = temp->data;
root->right = deleteNode(root->right, temp->data);
}
}
balance = getBalance(root);
// LL
if (balance > 1 ss getBalance(root->left) >= 0) return
rightRotate(root);
// LR
if (balance > 1 ss getBalance(root->left) < 0) { root-
>left = leftRotate(root->left);
return rightRotate(root);
}
// RR
if (balance < -1 ss getBalance(root->right) <= 0) return
leftRotate(root);
// RL
if (balance < -1 ss getBalance(root->right) > 0) { root-
>right = rightRotate(root->right);
return leftRotate(root);
}
return root;
}
int main() {
struct Node* root = NULL;
int insertVals[] = {30, 20, 40, 10, 25, 50, 5}; int i;
for (i = 0; i < 7; i++) {
root = insert(root, insertVals[i]);
printf("Level-order after inserting %d: ", insertVals[i]);
levelOrder(root);
}
return 0;
}
16. Tree Sort using BST
Objective: Sort elements using BST inorder traversal.
Tasks:
Insert: Elements into a BST.
Inorder Traversal: Output sorted list.
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node* left;
struct Node* right;
};
int main() {
int arr[] = {50, 30, 20, 40, 70, 60, 80};
int n = sizeof(arr)/sizeof(arr[0]);
inorder(root);
printf("\n");
return 0;
}
17. Trie Implementation
Objective: Store and search words/prefixes efficiently.
Tasks:
Insert: Add words to the trie.
Search: Check if a word exists.
Prefix Check: Determine if a prefix exists.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define ALPHABET_SIZE 26
struct TrieNode {
struct TrieNode* children[ALPHABET_SIZE];
bool isEndOfWord;
};
int main() {
struct TrieNode* root = createNode();
insert(root, "apple");
insert(root, "app");
insert(root, "bat");
insert(root, "ball");
typedef struct {
int data[MAX_SIZE];
int size;
int isMinHeap;
} Heap;
int i = heap->size;
heap->data[i] = value;
heap->size++;
int main() {
Heap minHeap = { .size = 0, .isMinHeap = 1 };
Heap maxHeap = { .size = 0, .isMinHeap = 0 };
printf("Min-Heap: ");
printHeap(sminHeap);
printf("Min-Heap peek: %d\n", peek(sminHeap));
printf("Max-Heap: ");
printHeap(smaxHeap);
printf("Max-Heap peek: %d\n", peek(smaxHeap));
return 0;
}
1G. Heap Sort Assignment
Title: Sort Array Using Heap Sort
Objective:
Implement Heap Sort using a Max-Heap.
Understand in-place sorting using heaps.
Tasks:
Build a max-heap from the array.
Repeatedly extract the max and move it to the end of the array.
Output the sorted array in ascending order.
Functions to Implement:
heapSort(arr)
#include <stdio.h> void
swap(int* a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
if (largest != i) {
swap(sarr[i], sarr[largest]);
heapify(arr, n, largest);
}
}
heapify(arr, i, 0);
}
}
int main() {
int arr[] = {12, 11, 13, 5, 6, 7};
int n = sizeof(arr) / sizeof(arr[0]);
printf("Original array:\n");
printArray(arr, n);
heapSort(arr, n);
printf("Sorted array:\n");
printArray(arr, n);
return 0;
}
20. Graph Traversals s Connected Components using Adjacency Matrix
Problem Statement:
Implement a program to:
1. Create an undirected graph using adjacency matrix
2. Perform BFS and DFS traversals
3. Find connected components
Input Format:
First line: Number of vertices (V) and edges (E)
Next E lines: Pairs of vertices (edges)
Last line: Starting vertex for traversal
Output:
1. Adjacency matrix
2. BFS traversal order
3. DFS traversal order
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
void initGraph() {
for (int i = 0; i < V; i++)
for (int j = 0; j < V; j++)
adj[i][j] = 0;
}
void printAdjMatrix() {
printf("Adjacency Matrix:\n"); for
(int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) printf("%d
", adj[i][j]);
printf("\n");
}
}
queue[rear++] = start;
visitedBFS[start] = true;
printf("\n");
printf("Connected Components:\n");
for (int i = 0; i < V; i++) {
if (!visitedCC[i]) {
printf("Component %d: ", ++componentCount);
dfsUtil(i, visitedCC);
printf("\n");
}
}
printf("Total Components: %d\n", componentCount);
}
int main() {
printf("Enter number of vertices and edges: "); scanf("%d
%d", sV, sE);
initGraph();
printAdjMatrix();
bfs(start); dfs(start);
findConnectedComponents();
return 0;
}
struct Edge {
int u, v, weight;
};
int find(int i) {
if (parent[i] == -1)
return i;
return find(parent[i]);
}
int main() {
int V, E;
printf("Enter number of vertices and edges: "); scanf("%d
%d", sV, sE);
printf("\nAdjacency Matrix:\n");
for (int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) printf("%3d
", adj[i][j]);
printf("\n");
}
totalWeight = 0;
printf("\nEdges in MST:\n");
for (int i = 0, count = 0; count < V - 1 ss i < E; i++) { int u =
edges[i].u;
int v = edges[i].v;
if (find(u) != find(v)) {
printf("%d - %d (weight %d)\n", u, v, edges[i].weight);
totalWeight += edges[i].weight;
unionSets(u, v);
count++;
}
}
printf("Total weight of MST: %d\n", totalWeight); return
0;
}
22. Prim’s Algorithm (MST) using Adjacency Matrix
Problem Statement:
Implement Prim’s algorithm to find MST in a weighted undirected graph using adjacency matrix.
Input Format:
First line: V (vertices) and E (edges)
Next E lines: u v w (edge from u to v with weight w)
Last line: Starting vertex
Output:
1. Adjacency matrix of the input graph
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
key[i] = INT_MAX;
mst_set[i] = false;
// Update key value and parent index of adjacent vertices for (int
v = 0; v < V; v++) {
// graph[u][v] is non-zero only for adjacent vertices
// mst_set[v] is false for vertices not yet in MST
// Update key only if graph[u][v] is smaller than key[v] if
(graph[u][v] ss !mst_set[v] ss graph[u][v] < key[v]) {
parent[v] = u; key[v]
= graph[u][v];
}
}
}
int main() {
int V, E;
printf("Enter number of vertices and edges: "); scanf("%d
%d", sV, sE);
graph[v][u] = w;
}
int start_vertex;
printf("Enter starting vertex: ");
scanf("%d", sstart_vertex);
return 0;
}
23. Dijkstra’s Algorithm (Single-Source Shortest Path) using Adjacency Matrix
Problem Statement:
Implement Dijkstra’s algorithm to find shortest paths from a source vertex using
adjacency matrix. Input
Format:
First line: V and E
Next E lines: u v w (directed edge from u to v with weight w)
Last line: Source vertex
Output:
1. Adjacency matrix
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
int main() {
int V, E;
printf("Enter number of vertices and edges: "); scanf("%d
%d", sV, sE);
int graph[MAX_VERTICES][MAX_VERTICES];
int src;
printf("Enter source vertex: ");
scanf("%d", ssrc);
return 0;
}
24. Floyd-Warshall Algorithm (All-Pairs Shortest Paths) using Adjacency Matrix
Problem Statement:
Implement Floyd-Warshall algorithm to find all-pairs shortest paths using adjacency matrix. Input Format:
First line: V and E
Next E lines: u v w (directed edge from u to v with weight w)
Output:
1. Initial adjacency matrix (with INF for no edges)
2. Final distance matrix (shortest paths between all pairs)
3. Sample path reconstruction
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
// Global variables
int adj_matrix[MAX_VERTICES][MAX_VERTICES]; int V,
E;
void print_adj_matrix() {
printf("Adjacency Matrix:\n"); for
(int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) { printf("%d ",
adj_matrix[i][j]);
}
printf("\n");
}
printf("\n");
}
push(stack, v);
}
int main() {
printf("Enter number of vertices and edges: "); scanf("%d
%d", sV, sE);
int src;
printf("Enter source vertex: ");
scanf("%d", ssrc);
return 0;
}
25. Topological Sort s Shortest Path in DAG using Adjacency Matrix
Problem Statement:
Implement topological sort and compute shortest paths in a DAG using adjacency matrix. Input
Format:
First line: V and E
Next E lines: u v (directed edge, weight = 1)
Last line: Source vertex
Output:
1. Adjacency matrix
2. Topological order
3. Shortest distances from source
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
// Global variables
int adj_matrix[MAX_VERTICES][MAX_VERTICES]; int
V, E;
push(stack, v);
}
int main() {
printf("Enter number of vertices and edges: "); scanf("%d
%d", sV, sE);
return 0;
}
26. Hashing: Hash Table with Chaining
Problem Statement:
Implement a hash table using chaining (linked lists) to resolve collisions.
Use a simple hash function: hash(key) = key % table_size.
Support insert, search, and delete operations.
Input Format:
First line: Size of the hash table (N).
Subsequent lines: Commands (insert <key>, search <key>, delete <key>, display, exit).
Output:
For search: Print "Found" or "Not Found".
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
return false;
}
return false;
}
int main() {
int size;
printf("Enter size of hash table: "); scanf("%d",
ssize);
while (1) {
printf("\nEnter command (insert/search/delete/display/exit): ");
scanf("%s", command);
if (strcmp(command, "insert") == 0) {
printf("Enter key to insert: ");
scanf("%d", skey);
insert(ht, key);
} else if (strcmp(command, "search") == 0) {
printf("Enter key to search: ");
scanf("%d", skey);
if (search(ht, key)) {
printf("Key %d: Found\n", key);
} else {
printf("Key %d: Not Found\n", key);
}
} else if (strcmp(command, "delete") == 0) {
printf("Enter key to delete: ");
scanf("%d", skey);
if (delete(ht, key)) {
printf("Key %d: Deleted\n", key);
} else {
printf("Key %d: Not found for deletion\n", key);
}
} else if (strcmp(command, "display") == 0) { display(ht);
} else if (strcmp(command, "exit") == 0) {
break;
} else {
printf("Invalid command\n");
}
}
free_hash_table(ht); return
0;
}
27. Hashing: Open Addressing (Linear Probing)
Problem Statement:
Implement a hash table using open addressing (linear probing).
Hash function: hash(key) = key % table_size.
Handle collisions by probing linearly.
Support insert, search, and delete.
Input Format:
First line: Size of the hash table (N).
Subsequent lines: Commands (insert <key>, search <key>, delete <key>, display, exit).
Output:
For search: Print index where key is found or "Not Found".
For delete: Mark the slot as "DELETED".
For display: Print the hash table.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DELETED -2
#define EMPTY -1
typedef struct {
int size;
int *table;
} HashTable;
if (index == original_index) {
printf("Hash table is full, cannot insert %d\n", key); return;
}
}
ht->table[index] = key;
printf("Inserted %d at index %d\n", key, index);
}
return -1;
}
int main() {
int size;
printf("Enter size of hash table: "); scanf("%d",
ssize);
command[10];
int key;
while (1) {
printf("\nEnter command (insert/search/delete/display/exit): ");
scanf("%s", command);
if (strcmp(command, "insert") == 0) {
printf("Enter key to insert: ");
scanf("%d", skey);
insert(ht, key);
} else if (strcmp(command, "search") == 0) {
printf("Enter key to search: ");
scanf("%d", skey);
int index = search(ht, key); if
(index != -1) {
printf("Key %d found at index %d\n", key, index);
} else {
printf("Key %d not found\n", key);
}
} else if (strcmp(command, "delete") == 0) {
printf("Enter key to delete: ");
scanf("%d", skey);
delete(ht, key);
} else if (strcmp(command, "display") == 0) { display(ht);
} else if (strcmp(command, "exit") == 0) {
break;
} else {
printf("Invalid command\n");
}
}
free(ht->table);
free(ht);
return 0;
}
28. Sequential File Handling in C
Problem Statement:
Write a C program to:
1. Create a sequential file (students.txt) with records (roll_no, name, marks).
2. Read and display all records.
3. Search for a record by roll number.
Input Format:
First, the program asks for records (roll_no, name, marks).
Then, it searches for a given roll number.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct
{ int roll_no;
char name[50];
float marks;
} Student;
void create_file() {
FILE *file = fopen("students.txt", "w"); if
(file == NULL) {
printf("Error creating file!\n"); exit(1);
}
int num_records;
printf("Enter number of student records to add: ");
scanf("%d", snum_records);
fclose(file);
printf("\nStudent records saved to file.\n");
}
void display_records() {
FILE *file = fopen("students.txt", "r"); if
(file == NULL) {
printf("Error opening file!\n"); return;
}
Student s;
printf("\nStudent Records:\n");
printf("Roll No\tName\tMarks\n");
printf(" \n");
fclose(file);
}
void search_record() { int
search_roll;
printf("\nEnter Roll No to search: ");
scanf("%d", ssearch_roll);
Student s;
int found = 0;
if (!found) {
printf("\nRecord with Roll No %d not found.\n", search_roll);
}
fclose(file);
}
int main() {
int choice;
while (1) {
printf("\nStudent Record System\n");
printf("1. Create/Add Records\n");
printf("2. Display All Records\n");
printf("3. Search by Roll No\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", schoice);
break;
case 3:
search_record();
break;
case 4:
exit(0);
default:
printf("Invalid choice. Please try again.\n");
}
}
return 0;
}
2G. Binary File Operations in C (Seek, Read, Write)
Problem Statement:
Write a C program to:
1. Create a binary file (data.bin) with integers.
2. Read and modify a value at a given position.
3. Display the updated file.
Input Format:
First, enter integers to store in the file.
Then, enter an index to modify and the new value.
printf("File contents:\n");
for (int i = 0; i < num_elements; i++) {
printf("Position %d: %d\n", i, numbers[i]);
}
free(numbers); fclose(file);
}
int main() {
const char *filename = "data.bin";
return 0;
}
30. External Sorting: Two-Way Merge
Problem Statement:
Simulate two-way merging of two sorted files (file1.txt and file2.txt) into a single sorted file (merged.txt).
Input Format:
file1.txt: 10 20 30
file2.txt: 15 25 35
void merge_files(const char *file1, const char *file2, const char *output) { FILE *f1
= fopen(file1, "r");
FILE *f2 = fopen(file2, "r"); FILE
*out = fopen(output, "w");
fclose(f1);
fclose(f2);
fclose(out);
}
void create_test_files() {
// Create sample input files
FILE *f1 = fopen("file1.txt", "w"); FILE
*f2 = fopen("file2.txt", "w");
if (f1) {
fprintf(f1, "10 20 30");
fclose(f1);
}
if (f2) {
fprintf(f2, "15 25 35");
fclose(f2);
}
}
int main() {
// Create test files
create_test_files();
// Merge files
merge_files("file1.txt", "file2.txt", "merged.txt");
return 0;
}
31. Natural Merge Sort on a File
Problem Statement:
Implement natural merge sort on a file (input.txt) containing unsorted numbers.
Steps:
1. Split the file into sorted runs.
2. Merge runs in passes until fully sorted.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
prev = current;
}
rewind(file);
return true;
}
}
}
while (!sorted) {
rewind(input);
rewind(temp1);
rewind(temp2);
// Check if sorted
rewind(output);
sorted = is_sorted(output);
pass++;
printf("Completed pass %d\n", pass);
}
// Clean up
fclose(input);
fclose(temp1);
fclose(temp2);
fclose(output);
remove("temp1.txt");
remove("temp2.txt");
remove("temp_pass.txt");
}
int main() {
// Create a sample input file
FILE *input = fopen("input.txt", "w"); if
(input) {
// Write some unsorted numbers
fprintf(input, "34 12 56 23 78 45 86 1 67 32 60 5");
fclose(input);
}
return 0;