This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
static ArrayList<Edge> edges; | |
// Since We don't know how many edges we have initially we used array list to change size dynamically. | |
static char colors[]; | |
// Colors array is used to specify the corresponding color for each edge colors.length == edges.size() | |
static int colors_number = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.stage.Stage; | |
import javafx.event.*; | |
import javafx.scene.layout.*; | |
import java.util.*; | |
import javafx.scene.shape.*; | |
import javafx.scene.paint.*; | |
import javafx.scene.input.MouseEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
using namespace std; | |
const int MAX = 10; | |
// MAX specifies the maximum size the list can take | |
// in the array case. | |
// compares two strings according to Alphabetical order | |
// if a string is greater than the other returns 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DATASTRUCTURE_H | |
#define DATASTRUCTURE_H | |
// a condition to avoid including this header file twice | |
#include <iostream> | |
#define MAX 100 | |
using namespace std; | |
struct Person { | |
char *firstName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "datastructure.h" | |
// include our custom header file | |
int main() { | |
char option; | |
bool loop = true; | |
Queue queue; | |
StackArray stack; | |
cout << "1. Add new Person" << endl; | |
cout << "2. Delete a Person" << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
// create a new file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HuffmanCodeGenerator { | |
// a class to hold all operation that are related | |
// to generating a huffman code | |
private void huffman() { | |
int[] twoMins = new int[2]; | |
findTwoMins(twoMins); | |
create(twoMins[0], twoMins[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.PrintWriter; | |
public class HuffmanCodeGenerator { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class Main { | |
public static void main(String[] args) { | |
// testing if the four algorithms are correct | |
int length = 10; | |
int max = 100; | |
int min = 0; |
OlderNewer