Visit the LQ Articles and Editorials section
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-19-2013, 10:50 PM   #16
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,982

Rep: Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443Reputation: 1443

Never mind "job interviews" .. or any such banal concerns.

The essential challenge that is posed by "any computing machine" is: how to make "a machine," despite its totally-silicon limitations, do something truly-useful for humans.

The limitations of digital computers have not changed since Von Neumann's time: they still consist of "1 and 0, with absolutely nothing in-between." The machinery still knows of nothing more than if..then..else. The gigabytes of (open source(!)) source-code that have been written since that time have not altered either the essential nature, or the essential challenge, of the problem.

Come with me, now, to what may seem to you to be "the dark ages." Surf to Amazon for the author James S Coan, and buy the titles, "Basic BASIC" and "Advanced BASIC." Circa 1976.

In those days, computers had advanced a full 30 years since Von Naumann's time, but (and I was there ... heh ...) had not yet advanced 40 years to the present day. Even so: "how things change... how things remain the same(!!)" (Electronic circuits are like that ...)

Grab these books, and solve the problems that they pose ... (without assistance!!) ... using the programming-languages and techniques of the present day. (After all, when these books were written, "BASIC" was "the programming-languages and techniques of the present day." And, guess what, 40 years from now ...)

"Welcome to our infatuation..."
Old 08-21-2013, 10:18 PM   #17
Senior Member
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Ubuntu
Posts: 1,369

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Originally Posted by frieza View Post
i remember a simple one from my programming class in college
create a program that outputs this
                 * *
                * * *
               * * * *
              * * * * *
             * * * * * *
            * * * * * * *
           * * * * * * * *
perhaps too simple?
make it so it takes input on how many rows tall
Improved awk to perform this task...
r=11  # r = number of rows in the output file
# cs = combined string
awk -v r=$r  \
 'BEGIN{for (j=1;j<=r;j++) cs=" " cs "* ";
        for (j=1;j<=r;j++) print substr(cs,j,j+r)}' >$OutFile
Daniel B. Martin
Old 08-21-2013, 11:48 PM   #18
Registered: Jan 2011
Distribution: slackware_64 14.1
Posts: 661
Blog Entries: 2

Rep: Reputation: 106Reputation: 106
One interesting exercise is to get a "can't lose" betting system from the internet for roulette or baccarat and write a simulation that uses the system.

To allay fears that your program's PRN might not produce real results, download a file of random bytes from and use those bytes to generate your random numbers.
Old 08-22-2013, 08:20 PM   #19
LQ Newbie
Registered: Aug 2005
Location: Canada
Distribution: Linux Mint, Ubuntu
Posts: 12

Rep: Reputation: 7
Post Programming Interview Books

Your best bet are programming interview questions. They're full of classical problems, brain teasers and complex problems. Classical problems meaning string operations, linked list questions, graphing problems, etc. Brain teasers like how many fish can you put into a barrel before it's full. Complex problems meaning, how would you optimize the hell out of a web site and use caching, etc.

The two books that are solid are:

Some algorithms/data structures books include exercises too. I would recommend Sedgewick Algorithms, 4th Edition.

You can find more questions on Project Euler and Career Cup.
1 members found this post helpful.
Old 08-23-2013, 09:14 PM   #20
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,690
Blog Entries: 1

Rep: Reputation: 1106Reputation: 1106Reputation: 1106Reputation: 1106Reputation: 1106Reputation: 1106Reputation: 1106Reputation: 1106Reputation: 1106
Originally Posted by danielbmartin View Post
Improved awk to perform this task...
r=11  # r = number of rows in the output file
# cs = combined string
awk -v r=$r  \
 'BEGIN{for (j=1;j<=r;j++) cs=" " cs "* ";
        for (j=1;j<=r;j++) print substr(cs,j,j+r)}' >$OutFile
Daniel B. Martin
And here's a python function that could do it. You can pass the number of rows to the function.
def tree(rows):
    for x in range(1, rows + 1):
        print(' ' * ((rows + 1) - x), ' *' * x)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
get "Print Screen" working under Gnome Classic cccc Debian 1 05-20-2013 04:16 PM
GNOME Shell to support a "classic" mode etech3 Linux - Desktop 2 11-23-2012 12:25 AM
LXer: A More "Classic GNOME" Session Lands In Ubuntu 12.04 Precise Pangolin LXer Syndicated Linux News 0 02-13-2012 02:00 PM
Socket Programming making use of "select()" and "writefds" johncsl82 Programming 10 11-13-2011 01:27 PM
"Classic" GNOME? Erik_the_Red Linux - Software 2 06-30-2005 03:50 AM

All times are GMT -5. The time now is 08:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration