What do you want to save?
Add Code snippet
New code examples
-
Other 2022-01-26 09:05:02
Use the linear linked list code to store a randomly generated set of 100 integers. Now write a routine that will rearrange the list in sorted order of these values.
// C program to implement Bubble Sort on singly linked list #include<stdio.h> #include<stdlib.h> /* structure for a node */ struct Node { int data; struct Node *next; }; &nbs... Add solution -
Other 2022-01-24 00:55:53
dynamic array c
// Use malloc to allocate memory ptr = (castType*) malloc(size); int *exampl = (int*) malloc(sizeof(int)); // Use calloc to allocate and inizialize n contiguous blocks of memory ptr = (castType*) calloc(n, size); char *exampl = (char*) calloc(20, sizeof(c... Add solution -
Other 2021-11-19 03:33:27
BFS AND DFS IN C
// BFS algorithm in C #include <stdio.h> #include <stdlib.h> #define SIZE 40 struct queue { int items[SIZE]; int front; int rear; }; struct queue* createQueue(); void enqueue(struct queue* q, int); int dequeue(struct queue* q); void d... Add solution -
Javascript 2021-11-16 08:49:24
write a program to insert a node in bst in c
#include<stdlib.h> #include<stdio.h> struct bin_tree { int data; struct bin_tree * right, * left; }; typedef struct bin_tree node; void insert(node ** tree, int val) { node *temp = NULL; if(!(*tree)) { temp = (node *)mall... Add solution -
Other 2021-11-09 19:39:29
huffman coding algorithm code
// Huffman Coding in C++ #include <iostream> using namespace std; #define MAX_TREE_HT 50 struct MinHNode { unsigned freq; char item; struct MinHNode *left, *right; }; struct MinH { unsigned size; unsigned capacity; struct MinHNode **... Add solution -
C++ 2021-11-09 19:30:20
how to delete repeated element in stack c++
int* stack = (int*)malloc(10 * sizeof(int)); int size = 10; int sp = -1; bool isempty() { return (sp == -1); } bool isfull() { return (sp == size - 1); } void push(int x) { if (isfull()) { printf("Full!"); } else {... Add solution