Follow Me

Sets exercises in C Programming in C

  • Kruskal Algorithm - Minimal Spanning Tree: The algorithm starts with V different trees (V is the vertices in the graph). While constructing the minimum spanning tree, every time Kruskal’s algorithm selects an edge that has minimum weight and then adds that edge if it doesn’t create a cycl...
  • Static implementation of a set - version 1: You are asked to give a static implementation of the ADT set having the following functions: void toempty(SET *S) int empty(SET S) int find(int x, SET S) void add(int x, SET *S) void removeS(int x, SET *S) void intersect(SET S1, SET S2, SET *R) void ...
  • Static implementation of a set - version 2: You are asked to give a static implementation of the ADT set having the following functions: void toempty(SET *S) int empty(SET S) int find(int x, SET S) void add(int x, SET *S) void removeS(int x, SET *S) void intersect(SET S1, SET S2, SET *R) void ...
  • Dynamic implementation of a set: You are asked to give a dynamic implementation of the ADT set having the following functions: void toempty(SET *S) int empty(SET S) int find(int x, SET S) void add(int x, SET *S) void removeS(int x, SET *S) void intersect(SET S1, SET S2, SET *R) void...
  • Implementation of a set using an array of Boolean: You are asked to give an implementation of the ADT set using an array of Boolean and having the following functions: void toempty(SET *S) int empty(SET S) int find(int x, SET S) void add(int x, SET *S) void removeS(int x, SET *S) void intersect(SET ...
  • Implementation of a set using a long integer as bits: You are asked to give an implementation of the ADT set using an array of bits and having the following functions: void toempty(SET *S) int empty(SET S) int find(int x, SET S) void add(int x, SET *S) void removeS(int x, SET *S) void intersect(SET S1,...
  • Implementation of a set using an array of long integers as bits: You are asked to give an implementation of the ADT set using an array of bits and having the following functions: void toempty(SET *S) int empty(SET S) int find(int x, SET S) void add(int x, SET *S) void removeS(int x, SET *S) void intersect(SET S1,...
  • Disjoint sets - Well known union find algorithm: A disjoint-set data structure is a data structure that keeps track of a set of elements partitioned into a number of disjoint subsets. The union-find algorithm is an efficient and fast algorithm that performs many useful operations: findSet: Determin...
  • ADT for a set of n elements: Write an ADT specification for a set of n elements. Operations include (create set, add an element to a set, delete an element from a set, check whether an element is in a set, union of 2 sets, intersection of 2 sets, cardinality of a set, complement...

Back to the list of exercises