As simple as this may seem to experienced Java programmers, I still see many posts in the Java Forums from beginners asking this very question: How do you read a text file line-by-line using a BufferedReader? Let’s find out.
Archive for the ‘CS 101’ Category
Doubly Linked List – Delete Middle Without Counting
The middle of a list is one record with equal number of records to the left and right (assuming the list has odd number of elements). If this number is even, the middle consists of two records. Write a pseudo-code procedure to delete the middle (one or two) record(s) of a doubly linked list without counting first or knowing the total number of elements in the list.
Reverse a Doubly Linked List
This question comes up often in undergraduate CS classes, specifically Data Structures and Algorithms: How do you reverse a doubly linked list? Let’s find out!
Sorting Algorithms
A while back I had to write a program that would compare different sorting algorithms in Java. The algorithms were Heap Sort, Merge Sort, and Quick Sort. I will leave the analysis up to you, but I will share the algorithms below.
PROJECT: Binary Search Tree
If you’re a CS student, it’s only a matter of time before you have to write a program implementing a Binary Search Tree. Below, I will go through how I would do it, but what makes this version different from most other examples on the Internet is that this one loads a configuration file (list of commands) and gives a specific output according to the instructions for my class at the time. Because the code to this assignment is pretty lengthy, I’ve made the source code available for download (MyBinarySearchTree.zip).
