LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 08-19-2013, 09:50 PM   #16
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,330

Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100

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, 09:18 PM   #17
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Ubuntu
Posts: 1,083

Rep: Reputation: 287Reputation: 287Reputation: 287
Quote:
Originally Posted by frieza View Post
i remember a simple one from my programming class in college
create a program that outputs this
Code:
                  *
                 * *
                * * *
               * * * *
              * * * * *
             * * * * * *
            * * * * * * *
           * * * * * * * *
perhaps too simple?
make it so it takes input on how many rows tall
Improved awk to perform this task...
Code:
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, 10:48 PM   #18
psionl0
Member
 
Registered: Jan 2011
Distribution: slackware_64 14.0
Posts: 526
Blog Entries: 2

Rep: Reputation: 68
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 http://www.random.org/bytes/ and use those bytes to generate your random numbers.
 
Old 08-22-2013, 07:20 PM   #19
OMouse
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, 08:14 PM   #20
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,561
Blog Entries: 1

Rep: Reputation: 1023Reputation: 1023Reputation: 1023Reputation: 1023Reputation: 1023Reputation: 1023Reputation: 1023Reputation: 1023
Quote:
Originally Posted by danielbmartin View Post
Improved awk to perform this task...
Code:
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.
Code:
def tree(rows):
    for x in range(1, rows + 1):
        print(' ' * ((rows + 1) - x), ' *' * x)
 
  


Reply


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 03:16 PM
GNOME Shell to support a "classic" mode etech3 Linux - Desktop 2 11-22-2012 11:25 PM
LXer: A More "Classic GNOME" Session Lands In Ubuntu 12.04 Precise Pangolin LXer Syndicated Linux News 0 02-13-2012 01:00 PM
Socket Programming making use of "select()" and "writefds" johncsl82 Programming 10 11-13-2011 12:27 PM
"Classic" GNOME? Erik_the_Red Linux - Software 2 06-30-2005 02:50 AM


All times are GMT -5. The time now is 02:02 PM.

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