473,804 Members | 3,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How create algorithms

Hi,

how do you create (design) algorithms.
I'm talking about thinking about it and come to an idea.

Tanks, FroxX
Jul 22 '05
10 1467
"FloWo3" <fl****@aol.com > wrote in message
news:20******** *************** ****@mb-m25.aol.com...

how do you create (design) algorithms.
I'm talking about thinking about it and come to an idea.


Examine the problem in small steps. Break down each little piece into
baby steps.

Contrary to other posts, I don't use paper and pen unless I'm trying to
visualize the actions of a loop of something like that.

I start in with an editor (not necessarily an IDE, Notepad works fine)
and start by just typing in comments of the steps I think I need, like
this:
---------------------------------------
// allocate variables

// open input file

// read data from file (into struct, line at a time, or whatever)
---------------------------------------

As I'm working I fill in things I find I need, like this:
---------------------------------------
// allocate variables
// loop counter, if necc.
// line buffer
// struct for file data, or alloc as needed

// open input file

// loop to read data from file into struct one line at a time
// read a line into line buffer
// parse line buffer into struct

// close file

// do something with data struct

// deallocate as necc.
---------------------------------------

The above is more C-like than C++, but you get the idea.

I try get the full problem scoped out before writing any real code, and
if some step is very complicated I just open another notepad for that
function or class. Eventually, I find things that I can fill in as real
code, but I try to resist that as long as possible.

Some will say that you have to use paper for this process, but editors
work for me. YMMV. On the plus side of this method you end up with fully
commented code at the end. And the comments are sometimes more correct,
since they change as the design is fleshed out - before the code is
written.

--
Mabden
Jul 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4180
by: Anders Borum | last post by:
Hello! I'm starting to dive into algorithms in general (sorting, trees etc.) and am currently reading a book from Robert Sedgewick called "Algorithms in C++, 3rd. Edition" and would like other book recommendations on algorithms, perhaps less hardcore than this one. Although very interesting, I realize I need to get a solid foundation before fully understanding the advanced topic covered in that book and would ask for recommendations...
17
6526
by: silverburgh.meryl | last post by:
In STL, there is no copy_if algorithm. But how can I emulate that? I am thinking about using find_if and then a copy. But how can I pass the InputIterator (begin and end) to copy so that it knows the range it tries to copy from. Thanks for any idea.
4
6987
by: Jonathan Wood | last post by:
Does anyone know why the documentation for System.Security.Cryptography.MD5.Create() seems to omit completely any description of allowed arguments. I'm trying to convert some C++ code to C# and seem to be getting different MD5 results. If other algorithms are available, maybe that is related to the problem I'm having. But the docs for this method don't tell me anything about what algorithms are supported? Thanks.
26
4109
by: vlsidesign | last post by:
I am a newbie and going through "The C programming language" by Kernighan & Richie on my own time (I'm not a programmer but I want to learn because it can save me time in my normal job, and it is kind of fun). As I go through the book, I seek to do all the exercises because they are very useful, and good, but it seems like I am just stumbling through somewhat. In particular, I don't really know how to think about "catching errors", or how...
19
7829
by: Dongsheng Ruan | last post by:
with a cell class like this: #!/usr/bin/python import sys class Cell: def __init__( self, data, next=None ): self.data = data
3
3725
by: arnuld | last post by:
i am looking for "algorithms in C++" book. Knuth is FULL of Mathematics, not my kind of author. i checked ACCU and got these (listing only those that are available in my country: 1. Algorithms in C++ -- Robert Sedgewick (3e) 2. Data Structures and Algorithms Analysis - Mark Allen Weiss (2e) 3. Introduction to Computing and Algorithms - Russell Shackelford (1e) 4. Introduction to Algorithms - Cormen et al.(2e)
17
2098
by: Happy Man | last post by:
Truth Seeker http://www.thisistruth.org/truth.php?f=TruthSeeker No one is compelled to accept the truth, but it is certainly a shame upon the human intellect when a man is not even interested in findingout what the truth is!
2
5168
by: =?Utf-8?B?Q3JtTmV3Ymll?= | last post by:
Hi, 1) I want to hone my problem solving skills and be good at logic. How do I achieve this? 2) Where can I find c# puzzles or c# algorithms. 3) How do I print the values of a N X N matrix using c#. 1 2 3 4 5 6 7 8
53
5266
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. I am working on my PhD Thesis, which is about Operations Research,
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.