Skip to content

Ananya1907/Ananya_Codes

Repository files navigation

C-Codes

Overview

This repository contains C codes using Arrays, Linked Lists, Stacks, Queues, Graphs, and Trees. The codes show the application and implementation of Breadth-First Search (BFS), Depth-First Search (DFS), and Binary Search Trees (BST).

Contents

* 'ConnectedComponents.c': Finds the number of connected components in the given graph.
* 'HeightBalanced_BST.c': Creates a height-balanced BST, given a sorted array (ascending order).
* 'LCA.c': Finds the Lowest Common Ancestor (LCA) of two nodes in a BST.
* 'Pattern1.c': Prints a pattern based on the input. Ex: Input-> a5B1k2		Output-> aaaaabkk.
* 'ShortestPath_BinaryMat.c': Finds the length of the shortest possible path from the top-left cell to the bottom-right in a binary matrix. Only cells whose values are 0 can be visited.
* 'Validate_BST.c': Checks if the given BST is a valid BST.
* 'WordLadder.c': Creates a word ladder and finds the length of the shortest path between two given words.
* 'kthSmallest_inBST.c': Finds the kth smallest value in a BST.
* 'BFS.c': Performs BFS on a graph given the start node/vertex. Also checks if the given graph is connected and counts the number of edges in that connected component.
* 'CommonNeighbor.c': Checks if two nodes (taken as input) have a common neighbor.
* 'DFS.c': Performs DFS on a graph given the start node/vertex.
* 'EulerTour.c': Checks if the given graph has an Euler Tour (assuming a connected graph).
* 'Triangle.c': Checks if the given graph has a triangle. A triangle consists of 3 nodes that are mutually adjacent.
* 'graph.c': A header file that contains codes on the creation of Linked Lists, Adjacency Lists, Stacks, Queues, Matrices, and Graphs

Releases

No releases published

Packages

No packages published

Languages