Follow Me

Generic trees exercises in C Programming in C

  • N-ary tree: A n-ary tree is a tree in which each node has at most $\texttt{n}$ children. The binary tree is a special case of n-ary tree in which n = 2.  Given the following n-ary tree structure #define n ...typedef ... element;typedef struct node {     e...
  • Generic Trees: A $$\texttt{Generic Tree}$$ can be represented as follows: **img**generictrees.png##img## The tree node declaration for general trees can be given as: typedef ... element; typedef struct node{    element data;    struct node *firstChild;  Â...
  • Spelling checker: (Session 2) In the proposed project during the year, you are asked to write a function that, given a string, returns the number of dictionary words with this string as a prefix (begins with that string).   (Session 1) In the proposed project, answer...
  • Height of a generic tree: Given a parent array Parent, where Parent[i] indicates the parent of ith node in the tree (assume parent of root node is indicated with –1). Write a fucntion that finds the height or depth of the tree. Example:  If Parent is the following $ \begin...
  • Construction of k-ary tree: A full k –ary tree is a tree where each node has either 0 or k children. Given an array which contains the preorder traversal of full k–ary tree, write a function that construct the full k –ary tree. **img**narytree1.png##img##...

Back to the list of exercises