top of page
Search

Data Structures and Algorithms in Java (OCS25) Course Tips

  • Apr 9, 2024
  • 12 min read

Updated: Nov 10, 2024

Are you taking Data Structures and Algorithms in Java (OCS25), wanting some tips for success? Are you considering taking the course in a future year? We interviewed peer tutors and instructors for this course, and here’s their advice about success in OCS25, as well as general information about it.

 

 

Course Overview

OCS25, a course teaching the same amount or more material than an equivalent college course, introduces students to some of the most important and widely-used algorithms that have been developed. Throughout the course, students explore the question “can we do better?” for an assortment of problems. There are many ways to solve a problem and students explore the trade-offs—such as between time and space—that are faced in the development of algorithms.

 

 

Course Topics

OCS25 introduces students to a variety of algorithms and data structures to solve a variety of problems. The major topics covered are sorting, searching, graph theory, and strings. Students will be doing coding, but they will also do a lot of tracing (showing how some data is affected by a particular algorithm). The course works both in the theoretical and relates the theoretical back to particular coding implementations. Students will also learn a lot about different sorts of computing problemswhich ones are solvable and, of the solvable ones, which are hard or easy and why.

 

Examples of data structures students work with in OCS25:

  • Arrays

  • Linked lists

  • Queues

  • Stacks

  • Priority Queues

  • Binary Search Trees

  • Red-Black Trees

Some algorithms students work with:

  • Selection Sort

  • Insertion Sort

  • Shell Sort

  • Merge Sort

  • Quicksort

  • 3-Way Quicksort

  • Sequential Search

  • Binary Search

  • Hashing

  • Depth-First Search

  • Breadth-First Search

  • Topological sort

  • DAG algorithms

  • Kosaraju-Sharir algorithm for strong components

  • Prim’s and Kruskal’s Minimum Spanning Tree algorithms

  • Dijkstra’s shortest paths algorithm

  • Bellman-Ford algorithm

  • Network flow algorithms and the max-flow min-cut theorem

  • String sorting

    • LSD

    • MSD

  • 3-way string Quicksort

  • Tries (note: this is the plural of “trie,” not of “try”)

  • Substring search algorithms

  • Data compression algorithms


 

Course format and workload

  • Before class, students should look over the assigned textbook reading. This is estimated to take 2-3 hours per week. Students should gain a broad overview of the topic from the reading.

  • During class, the instructor will go over a series of slides with students, in a sort of lecture style. Students may also do some practice problems. Class time helps students to deeply understand the concepts.

  • If students have time, it can also be beneficial to look over the class slides independently, either before class or after it.

  • Every one or two weeks there will be an assignment to complete. The time per assignment is very individual, but it's estimated at anything from 2-8 hours per assignment. Instructors aim for about 4 hours spent on each assignment (on average) and encourage students to reach out if it’s taking too much longer than that. Assignments teach students to apply the concepts they’ve learned.

  • Especially before tests, but also at other times if possible, revisit previous concepts. Review will help to ensure that students truly and permanently grasp an idea.

  • OCS25 has a pen-and-paper, in-person proctored final and midterm in both semesters. The midterm and final, together, count for 50% of a student’s grade in both semesters.

Overall, Data Structures and Algorithms in Java is a high-workload course, compared to other OHS courses.

 


Frequent challenges

Of course, which topics students find challenging is very individual. However, here are some topics that students commonly found difficult:

  • If students don’t have a good grasp of chapter 2 of the textbook, the course becomes more challenging later, because later material builds off earlier material.

  • Quicksort was frequently challenging, as it is a recursive algorithm. Recursion is a conceptually challenging topic for many students.

  • Red-Black Trees can be challenging as they are one of the most complex topics that students work with all year. It can be hard to see why and how the algorithms work, and there are many cases to remember.

Students also frequently found the following aspects of the course in general to be challenging:

  • This is a very advanced course and the topics are conceptually difficult!

  • The assignments are also challenging and can be quite time-consuming.

  • Exams are very difficult. Not only is there a lot of work to be completed in a short time, but the nature of the exams requires students to memorize and understand both the code for, and effect of, many different algorithms. Exams also are a large portion of students’ grade in both semesters.

  • There is a large adjustment from the workload of previous computer science courses at OHS to the workload for this course. OCS25 has a very high workload, and this takes some getting used to.

 

This information is intended to help you anticipate what challenges you may find during this course, so you can best direct your study efforts and be prepared.

 

 

Available supports

  • Peer tutors are students who have previously taken the course and are available to help students

    • Peer tutors can be reached through appointments at the Writing and Tutoring Center. Schedule an appointment here: Stanford OHS Writing & Tutoring Center (mywconline.com)

    • Sometimes, a fellow student can explain something better than a teacher can, because they know what it’s like to be a student and where another student is likely to struggle to understand something.

    • Many peer tutors are also easily reachable through Pronto. Feel free to message a peer tutor if you’re stuck on an assignment and need a nudge in the right direction!

  • Your instructor is also there to help you

    • Instructors hold office hours once or twice a week, where students can come to discuss course topics.

      • Note that you do not need to have a particular question to attend office hours—you can come to discuss a general topic, explore an idea you have, ask a specific question about homework, and much more! Students can even come to office hours to ask why a particular solution is optimal, or why one thing is done but not another—under the guidance of an instructor, they can conduct a sort of research, comparing, for example, the running times of different implementations of algorithms.

      • You are never inconveniencing your teacher by attending office hours—they want to talk to you.

      • If you find it hard or embarrassing to ask questions in class, office hours can be a great place to ask questions, when you can just talk to your instructor 1-on-1. It is very normal to feel hesitant about asking questions—you are not alone! However, since all the material builds on previous material, making sure you find a way to ask any questions you have is very important.

    • Instructors can also be reached by email. You might decide to email your teacher, for example, if you have a (relatively quick) question that needs to be answered before their next office hours.



Exams and exam preparation

OCS25 has a pen-and-paper, in-person proctored midterm and final in both semesters. Though the exam is pen-and-paper, students have sometimes been permitted to take a computer and type what parts of the exam they wish (however only some parts can reasonably be typed), though they may not use an IDE. The midterm and final, together, count for 50% of a student’s grade in both semesters. The following methods have been helpful to previous students in studying:

  • The list of topics put up on the whiteboard in class is a good place to start with your studying. However, don’t limit yourself to just these topics—understanding everything in the course will be very helpful. Of course, focus on the topics that your instructor has directly said will be on the exam. But going beyond that is not a waste of your time, as having a fuller understanding of everything will help you with the topics that are on the exam.

  • Take advantage of the lecture slides. They're very good summaries of the material that was taught and will help you to understand expectations for the exams.

  • Make sure that you can just sit down and write a given piece of code or do a trace for a given algorithm, without reference to the textbook or your notes. On the exam you will not have access to these.

  • The exam will test basically everything you've learned all semester. Be prepared for that.

  • Be prepared for the speed of the test. Even though the tests are long in length, they have a lot of material on them. You will likely be working at top speed throughout the entirety of the test. When you're studying, make sure that you can not only do traces/implementations without reference to the book or your notes, but that you're also able to do them quickly.

  • If you're confused on anything, always attend office hours or a peer tutoring session (or both). You can even go just to ask for study strategies for the test. Your instructor may also be able to provide you with additional practice materials if you ask for them at office hours.

  • You're always allowed to clarify expectations for a test. If you have any questions at all about expectations, definitely clarify with your teacher.

  • Practice, practice, practice! This is really the best thing you can do to prepare for both the speed and the range of content of the exams.

  • Of course, there are limitations on how much time you're going to have to study. Start by looking over the assignments and try making new problems that are small variations of assignment problems. Questions on the tests are often similar to homework questions. Next, look over the class slides. If you still have time, look over the recorded classes and textbook. When you have a limited amount of time to study, this prioritization can be helpful.

 

During the test, prioritize which questions to work on. If one question is taking a very long time or you just don't know how to do it, move on and come back to it at the end if there's still time. If you're stuck on question number one, it's better that you get 85 points from the rest of the test than that you spend all of your time on the first problem and may or may not even get those 15 points. Skipping around is absolutely okay.

 

Note: if you use pencil on exams, it can come in very light when a proctor scans your test paper. Try to make your writing nice and dark, as the scanning will only make it lighter.



Outside resources

Besides the textbook, class slides, and other class materials, past students have found the following resources helpful:

  • There is a website that accompanies the textbook. This website contains, among other resources, code for all algorithms found in the textbook. This code is great for studying implementations, and you can also copy it into an IDE as a starting point for many assignments (if you use this code, remember to give attribution to the author! If you have questions about this, speak with your instructor.). Link: Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne (princeton.edu)

  • Know how to use Javadocs—be both able to read and write them. Knowing how to read them is very useful for looking up pre-existing functions (e.g., Arrays.sort()). They are also a tidy format to follow when putting comments in your code.

  • Stack Overflow and Stack Exchange, places where people can go to ask questions about programming, can also sometimes be helpful. They can be places to find additional information about how to apply/use/do certain things—for example, someone might include a sample of how to override a toString() method on one of these websites.

  • YouTube can be helpful at times as well. There are many videos explaining computer science topics, and it can be nice to get another perspective on the topic if you’re very confused. Also, YouTube videos can be especially helpful for visual learners since many videos have helpful visuals.

Instructors have emphasized that students are allowed to use these sorts of outside resources to improve their understanding of the material. Someone has probably done what you’re trying to do before you, and you can find a lot of that knowledge online. (Of course, this does not mean you can go look up exact solutions to homework problems and take someone else’s code without attribution. Outside resources are there to help you learn, not to do the work for you.)

 

 

Other tips for success

  • Don’t underestimate how your classmates can help you. A classmate might have understood something that you didn’t and be able to explain how they came to understand it. And sometimes, just talking through a question with a peer and bouncing ideas off each other helps both of you to come to a better understanding of the topic.

  • It’s easy to underestimate the challenge level of assignments. Start early so that you have enough time to come to a full understanding of the challenge of the problem, and discover any bugs that might arise, before it’s too late to ask for help if you need it.

    • Even if you can’t get started on the assignment super early because of other schoolwork, just reading through the assignment is helpful.

    • Try to read over or even start the assignment before class, so that you can ask any questions you need to on the topic during class time.

  • Many students feel hesitant to ask questions in class, often because they are afraid to embarrass themselves in front of classmates. If you feel this way, it’s very normal, and you’re not alone. However, because much of the material builds on previous material, finding a comfortable way to ask questions is important. Attending office hours or peer tutoring is one great way to do this, without any of your classmates around. You can also email your teacher if that’s more comfortable, but do know that it can be challenging for a teacher to write a full explanation via email, and it’s harder for you to ask follow-up questions this way.

  • There is reading to do before each class. Although students will get a lecture-style summary of this material during class, doing the reading is also extremely valuable. The reading presents the material in a different way—and sometimes has a bit of extra material, like a proof. Seeing the material before class and then deepening one’s understanding of the material during class will yield a better understanding in the end.

  • Take full advantage of the textbook. It contains lots of helpful information to refer to, explanations of code, and practice problems at the end of each section.

  • Take advantage of all the available supports—including office hours, peer tutoring, and even your classmates—as much as possible and whenever you have questions. These supports are here to help you, never be afraid to reach out!

  • Make sure that you really understand how the algorithms function. Of course, you will need to memorize implementations for your exams. However, make sure that, beyond the fine details of an implementation, you really understand what the algorithm does and how it works. This will be important to your ability both to do tracing and to implement and apply what you’ve learned. It will also be very important to your overall understanding of the material and ability to use it later.

  • For some students, computer science was relatively easy in previous courses. Don’t assume that it will be the same way in Data Structures and Algorithms in Java! This course has a much higher workload and level of conceptual difficulty.

 

 

Why take this course

OCS25 is undeniably a very challenging course—challenging students’ skills in programming, math, and probability alike. However, students have found this struggle enjoyable because the material is fun. OCS25 has fostered a love of computer science for many students.

OCS25 is also an important gateway course for those looking to pursue later computer science (or related fields). A course about data structures and algorithms is essential for anyone looking to do computer science/programming, and it is possible to do software work after having taken a course like this one. In the same sense that calculus is a fundamental course that one needs to take to do most things in math or science, a course in data structures and algorithms opens the door to learning about machine learning, artificial intelligence, cyber security, data science, and even physics. A data structures and algorithms course is also essential for anyone looking to major in computer science. This is a college-level course that OHS students can take in high school, which will give students a significant leg up in college.

OCS25 also teaches students what computer science really means. Though some computer science concepts are certainly taught in earlier classes, those classes serve to give the foundation in programming so that students can step fully into the realm of computer science in OCS25. OCS25 is the core of computer science. It’s very problem-and-solution based, and students learn the real-world implications of solving certain problems. Students will begin to understand the point of computer science and algorithms, and the difference between a computer scientist and a programmer. Even though you will likely forget the particular implementation of a Quicksort, the ways of thinking and computer science principles won’t be lost. And, if you ever needed to write a Quicksort again, you can look up the details of the code—what’s important is understanding why to use it, and what it’s really doing.

Finally, even if you don’t end up going into a computer science field, OCS25 is still valuable. We all use countless algorithms every day—sometimes, without even knowing it. How does Google Maps work? Graph theory! How is real-world data sorted, in countless situations? Quicksort or Merge Sort (well, we hope…if not, that’s an issue). Understanding these fundamental and widely-used algorithms can help students to look at the world in a different way.

 

 

OCS25 is a very difficult course. However, this challenge can be very rewarding if students are able to take advantage of the available supports. In time, you will learn what strategies work for you to manage the high workload and conceptual difficulty of the course. And if you ever need help, or it seems impossible to succeed, you can always reach out to us.

 
 
 

Recent Posts

See All
Advice from Student Leader Rachael L.!

Rachael is the captain of the robotics club, an editor of the Pixel Journal, and the club leader of the Biology Olympiad Club. Read on to hear her advice for student leaders! What skills have you lear

 
 
 

Comments


Board of Student Academic Support and Services

Feel free to reach out to us by visiting the contact page.

bottom of page