Coder Social home page Coder Social logo

ediloaz / bst-dynamic-vs-bst-greedy Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1009 KB

Finds the BST optimal using a dynamic and a greedy algorithm. Analyze both trees and processing time of the solution (on Latex document).

C 72.74% Makefile 4.30% C++ 9.14% TeX 13.81%
bstree binary-search-tree operations-research comparative-analysis dynamic-programming greedy-algorithms linux c

bst-dynamic-vs-bst-greedy's Introduction

BST Dynamic vs BST Greedy

This program was created as part of an evaluation of a bachelor course in engineering. Resolves and find the optimal BST (Binary Search Tree) using two algorithms:

Both were programmed in C on Linux, the main purpose was not to find the tree, but to make a comparison between these two algorithms taking the time and the "correct solution" factors.

Input

Is on the Linux terminal, not has a interface, the user can use two different ways:

  • Example mode
  • Experiment mode

Example mode

Generate and solve a single random case with the two algorithms. The execution of the program generates a latex document where it specifies the initial problem, the response with the greedy algorithm, the response with the dynamic programming algorithm (both with their respective tables) and the conclusions reached in that execution.

The input must will be:

./program -X

Screenshot of the terminal in Example mode

Experiment mode

Generates and solves N random cases, collects statistical data. The execution of the program generates a latex document where it specifies the amount of data that will be used, the time tables of both algorithms, as well as an additional one which shows the percentage of optimal responses produced by the Greedy algorithm.

The input must will be:

./program -E=N

Where the "N" parameter is the number of N*10 random cases that you want.

Screenshot of the terminal in Experiment mode

Output

A .tex file (and others files required) will create and convert to pdf with pdflatex command and will open with evince command. All these files are saved in output folder. And each mode create a different document structure.

Example mode

Screenshot of an example of Example mode

Screenshot of an example of Example mode

Experiment mode

Screenshot of the Experiment mode

Prerequisites

It is necessary to have installed latex (including pdflatex), pkg-config and evince in your linux. You can install it with the following commands:

sudo apt-get install texlive-full
sudo apt-get install texmaker
sudo apt-get install evince
sudo apt install pkg-config

Running

First is necessary compile the main file (main.c) with the command

 gcc -o program main.c

and then it can be opened

./program

Built With

Authors

  • Edisson López - Main developer - ediloaz

See also the list of repositories who I participated/created.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.