637 Topics

Member Avatar for
Member Avatar for markrezak

//Binary Search Tree Program #include <iostream> #include <cstdlib> using namespace std; class BinarySearchTree { private: struct tree_node { tree_node* left; tree_node* right; int data; }; tree_node* root; public: BinarySearchTree() { root = NULL; } bool isEmpty() const { return root==NULL; } void print_inorder(); void inorder(tree_node*); void print_preorder(); void preorder(tree_node*); void …

Member Avatar for dkalita
-1
433
Member Avatar for hny_lyn

To begin, we were asked to make a TREE... It says that we should traverse the left subtree of the ROOT/NODE in postorder and then make a copy of it... Next is to traverse the right subtree of the ROOT/NODE in postorder and then make a copy of it... Lastly, …

Member Avatar for quuba
0
526
Member Avatar for sftwr21

I'm a noob when it comes to C programming. I wrote a simple program that runs an infinite for loop. But inside that loop I wanted to create another loop to stop the user three times after entering incorrect passwords. I tested from different angles it seems like the infinite …

Member Avatar for sftwr21
0
212
Member Avatar for Der_sed

[CODE]#include <iostream> #include <cstdlib> using namespace std; const int arrSize = 100; bool isPresent(int ,int ); int main() { int myArr[arrSize]; int input; for (int i=0; i<=arrSize; i++) myArr[i]=rand()%200; //creating array with random numbers //sorting random numbers for (int j=0; j<=arrSize; j++){ for(int k=0; k<j ; k++){ if (myArr[j] < …

Member Avatar for VernonDozier
0
92
Member Avatar for smco9

This is suppose to be a simple selection sort but I think I'm missing something because my output isn't completed sorted right. [CODE]void SelectionSort(data list[], int length) { int index; int smallestIndex; int minIndex; data temp; for( index = 0; index < length; index++) { smallestIndex = index; for(minIndex = …

Member Avatar for vincent2085
0
187
Member Avatar for nomemory

Hello, I am a python newbie and I am trying to accommodate to the basics. What's the python equivalent for the following Java snippet ? [B]Java:[/B] [CODE]public class Main { public static void main(String args[]){ int a,b,c; a= (int) (Math.random()*100); c=0; while((b=(int)(Math.random()*100))!=a){ c+=1; } System.out.println(c); } }[/CODE] I was trying …

Member Avatar for woooee
1
215
Member Avatar for Narue

This quicksort implements the basic recursive algorithm with three improvements. The first improvement is choosing the pivot based on the median of three values in the list to be sorted. This minimizes the chances of a worst case scenario. The second improvement speeds up the algorithm by termination when subfiles …

Member Avatar for Matt Labbé
1
1K

The End.