Skip to content

Questions from The Algorithm Design Manual 3rd Edition

Notifications You must be signed in to change notification settings

Rwright7/DataStruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project: BST to Linked List Conversion (BSTLinkedList.c)

This C program demonstrates the conversion of a Binary Search Tree (BST) into a linked list. The program includes functions to create a BST, traverse it in-order, and print the corresponding linked list. The main function initializes a sample BST, performs the conversion, and outputs the result.

How to Run

Compile the program using a C compiler:

gcc BSTLinkedList.c -o BSTLinkedList

Run the executable:

./BSTLinkedList

Project Structure

  • BSTLinkedList.c: The main source code file containing the implementation.
  • README.md: Project documentation.

Code Overview

The program defines structures for nodes in a BST and linked list. It includes functions to create a new node, insert nodes into the BST, and traverse the BST to create a linked list. The main function initializes a sample BST, performs the conversion, and prints the result.

Usage

The program initializes a BST and prints its in-order traversal. It then converts the BST into a linked list and prints the linked list.

Project: Integer Division without "/" or "*" Operators (integerDivision.c)

This C program demonstrates how to perform integer division without using the "/" or "*" operators. The divide function takes two integers as input and calculates the quotient and remainder without using the mentioned operators.

How to Run

Compile the program using a C compiler:

gcc integerDivision.c -o integerDivision

Run the executable:

./integerDivision

Project Structure

  • integerDivision.c: The main source code file containing the implementation.
  • README.md: Project documentation.

Code Overview

The program defines a divide function that takes two integers as input and calculates the quotient and remainder without using the "/" or "*" operators. The main function demonstrates the usage of the divide function.

Usage

The program initializes two integers, performs the integer division, and prints the quotient.

Project: Reverse a Singly Linked List (reverseLinkedList.c)

This C program provides an algorithm to reverse the direction of a given singly linked list. The program defines structures for linked list nodes and includes functions to add nodes at the beginning, print the list, reverse the list, and free the allocated memory.

How to Run

Compile the program using a C compiler:

gcc reverseLinkedList.c -o reverseLinkedList

Run the executable:

./reverseLinkedList

Project Structure

  • reverseLinkedList.c: The main source code file containing the implementation.
  • README.md: Project documentation.

Code Overview

The program defines a reverse function to reverse the direction of a given singly linked list. The main function initializes a sample linked list, prints it, reverses it, and prints the reversed list.

Usage

The program initializes a linked list, prints it, reverses it, and prints the reversed list.

Project: Reverse Sentences in C (reverseSentence.c)

This C program reverses a series of input lines, effectively reversing the order of words in each line and the order of lines themselves.

How to Run

Compile the program using a C compiler:

gcc reverseSentence.c -o reverseSentence

Run the executable:

./reverseSentence

Project Structure

  • reverseSentence.c: The main source code file containing the implementation.
  • README.md: Project documentation.

Code Overview

The program reads a series of lines as input, reverses the order of words in each line, and then reverses the order of lines. It utilizes dynamic memory allocation to store lines.

Usage

Enter a series of lines as input, and the program will output the reversed sentences.


Feel free to compile and run these programs on your local machine to observe their functionality. If you have any questions or need further clarification, please let me know!

About

Questions from The Algorithm Design Manual 3rd Edition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages