background preloader

CS fundamentals

Facebook Twitter

Inc. Adventure in Prolog tutorial. Prolog stands for PROgramming in LOGic. It was developed from a foundation of logical theorem proving and originally used for research in natural language processing. Although its popularity has sprung up mainly in the artificial intelligence (AI) community, where it has been used for applications such as expert systems, natural language, and intelligent databases, it is also useful for more conventional types of applications.

It allows for more rapid development and prototyping than most languages because it is semantically close to the logical specification of a program. As such, it approaches the ideal of executable program specifications. Programming in Prolog is significantly different from conventional procedural programming and requires a readjustment in the way one thinks about programming. Logical relationships are asserted, and Prolog is used to determine whether or not certain statements are true, and if true, what variable bindings make them true. Nani Search is composed of ? Laurence Tratt: Parsing: The Solved Problem That Isn't. Updated (2014-10-24): If you find this article interesting, you may be interested in the follow-up article on an editor for composed programs. Parsing is the act of taking a stream of characters and deducing if and how they conform to an underlying grammar.

For example the sentence Bill hits Ben conforms to the part of the English grammar noun verb noun. Parsing concerns itself with uncovering structure; although this gives a partial indication of the meaning of a sentence, the full meaning is only uncovered by later stages of processing. Parseable, but obviously nonsensical, sentences like Bill evaporates Ben highlight this (the sentence is still noun verb noun, but finding two people who agree on what it means will be a struggle). In computing, parsing is also common; while the grammars are synthetic (e.g. of a specific programming language), the overall idea is the same as for human languages. The general consensus, therefore, is that parsing is a solved problem. Language composition. Brushing up on Computer Science Part 1, Big O » Victus Spiritus. “Those who cannot remember the past are condemned to repeat it”George Santayana Intro Memory is such a fragile construct, yet we are forced to cruelly mold it into submission through extreme repetition and clever tricks of association.

And even then, detailed memories fade exponentially in time and are of little use without regular access and utilization. Early this morning I was inspired to review the basics of computer science, including object oriented programming, data structures, common algorithms and characterization of complexity (Big O) by blogging friend Denton Gentry. I leave the source of my inspiration as an exercise in deductive reasoning. These posts will serve as a study guide for myself, and anyone else who chooses to read or contribute to them. Big O Let’s begin with a review of Big O or Big Omicron.

Big O notation seeks to describe the relative complexity of an algorithm by reducing the growth rate to the key factors when the key factor tends towards infinity. What Every Developer Should Know About URLs. I have recently written about the value of fundamentals in software development. I am still firmly of the opinion that you need to have your fundamentals down solid, if you want to be a decent developer. However, several people made a valid point in response to that post, in that it is often difficult to know what the fundamentals actually are (be they macro or micro level).

So, I thought it would be a good idea to do an ongoing series of posts on some of the things that I consider to be fundamental – this post is the first instalment. Being a developer this day and age, it would be almost impossible for you to avoid doing some kind of web-related work at some point in your career. As a web developer you really have no excuse for not knowing everything there is to know about URLs, there is just not that much to them. The Structure Of A URL This is easy, starts with HTTP and ends with .com right :)? <scheme>://<username>:<password>@<host>:<port>/<path>;<parameters>?

Related. DP Zoo Tour : Inside T5. Someone told me it’s all happening at the zoo... I’ve always thought dynamic programming was a pretty crummy name for the practice of storing sub-calculations to be used later. Why not call it table-filling algorithms, because indeed, thinking of a dynamic programming algorithm as one that fills in a table is a quite good way of thinking about it. In fact, you can almost completely characterize a dynamic programming algorithm by the shape of its table and how the data flows from one cell to another. And if you know what this looks like, you can often just read off the complexity without knowing anything about the problem. So what I did was collected up a bunch of dynamic programming problems from Introduction to Algorithms and drew up the tables and data flows. The blue indicates the cells we can fill in ‘for free’, since they have no dependencies on other cells. Here’s the next introduction example, optimal parenthesization of matrix multiplication.

Here we get into exercise land! A Gentle Introduction to Machine Fundamentals. It seems your browser does not support the scripts on this page. Use a recent version of Chrome or Firefox to see this tutorial in all its glory. For now, you get the non-interactive version. Topic: Machine language programming, computer graphicsAuthor: Marijn HaverbekeDate: January 18th 2011 This article is an elaboration of part of Eloquent JavaScript's introduction. Like that website, this page has an interactive coding environment to help you get a feel for the subject. The text aims to be readable even for people with little to no existing knowledge of the subject, and to work towards its conclusion without detours. Why Computers Are Interesting A clockwork represents just activity, going round and round without story or direction. An elementary computer has two parts, a memory (information) and a processor (action). Memory is the easiest of the two to describe. Memory words each hold a fixed number of bits.

The processor's behaviour is somewhat more complicated. The Mechanical Turtle. What every programmer should know about memory, Part 1. September 21, 2007 This article was contributed by Ulrich Drepper [Editor's introduction: Ulrich Drepper recently approached us asking if we would be interested in publishing a lengthy document he had written on how memory and software interact. We did not have to look at the text for long to realize that it would be of interest to many LWN readers.

Memory usage is often the determining factor in how software performs, but good information on how to avoid memory bottlenecks is hard to find. This series of articles should change that situation. The original document prints out at over 100 pages. We will be splitting it into about seven segments, each run 1-2 weeks after its predecessor. Reformatting the text from the original LaTeX has been a bit of a challenge, but the results, hopefully, will be good. Many thanks to Ulrich for allowing LWN to publish this material; we hope that it will lead to more memory-efficient software across our systems in the near future.] 1 Introduction 1.3 Thanks.

Algorithms and Data Structures. Algorithm: a process or set of rules used for calculation or problem-solving, esp. with a computer.Program: a series of coded instructions to control the operation of a computer or other machine. Example Problem: Find the greatest common divisor (GCD) of two integers, m and n.Euclid's Algorithm: while m is greater than zero: If n is greater than m, swap m and n. Subtract n from m. n is the GCD Program (in C): Correctness Why do we believe that this algorithm devised thousands of years ago, is correct? Given m>0 and n>0, let g = gcd(m,n). So the algorithm is correct, provided that it terminates. Termination At the start of each iteration of the loop, either n>m or m≥n. So the algorithm does terminate. Testing Having proved the algorithm to be correct, one might argue that there is no need to test it. Debugging code be inserted to print the values of m and n at the end of each iteration to confirm that they behave as expected.

Complexity Time If m=n, there is just one iteration; this is the best-case. The Full Stack, Part I.