Reader small image

You're reading from  Learn Data Structures and Algorithms with Golang

Product typeBook
Published inMar 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781789618501
Edition1st Edition
Languages
Right arrow
Author (1)
Bhagvan Kommadi
Bhagvan Kommadi
author image
Bhagvan Kommadi

Bhagvan Kommadi, Founder, Architect Corner has around 18 years experience in the industry ranging from large-scale enterprise development to incubating software product startups. He has done Masters in Industrial Systems Engineering at Georgia Institute of Technology (1997) and Bachelors in Aerospace Engineering from Indian Institute of Technology, Madras (1993). He is currently working as CTO of Crystal Delta Solutions. He is the member of IFX forum and an Individual member of Oracle JCP. He has developed Go language based blockchain solutions in retail, education, banking, and financial services sectors. These blockchain solutions were based on Chain Core (Go language based), Ethereum and Hyperledger blockchain platforms. He has experience in building high transactional applications using Java, C, C++, C#, Python, Go, Ruby and JavaScript frameworks. He has reviewed books such as Beyond Software Architecture-Creating and sustaining winning solutions by Luke Hohmann and Algorithms of the intelligent Web by Dr. Haralambos (Babis) Marmanis.
Read more about Bhagvan Kommadi

Right arrow

Ordered lists

Lists in Go can be sorted in two ways:

  • Ordered list: By creating a group of methods for the slice data type and calling sort
  • Unordered list: The other way is to invoke sort.Slice with a custom less function

The only difference between an ordered list and an unordered list is that, in an ordered list, the order in which the items are displayed is mandatory.

An ordered list in HTML starts with an <ol> tag. Each item in the list is written in <li> tags. Here's an example:

<ol>
<li>Stones</li>
<li>Branches</li>
<li>Smoke</li>
</ol>

An example of an ordered list using Golang is shown in the following code snippet. The Employee class has Name, ID, SSN, and Age properties:

///main package has examples shown
// in Go Data Structures and algorithms book
package main

// importing fmt and sort package...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learn Data Structures and Algorithms with Golang
Published in: Mar 2019Publisher: PacktISBN-13: 9781789618501

Author (1)

author image
Bhagvan Kommadi

Bhagvan Kommadi, Founder, Architect Corner has around 18 years experience in the industry ranging from large-scale enterprise development to incubating software product startups. He has done Masters in Industrial Systems Engineering at Georgia Institute of Technology (1997) and Bachelors in Aerospace Engineering from Indian Institute of Technology, Madras (1993). He is currently working as CTO of Crystal Delta Solutions. He is the member of IFX forum and an Individual member of Oracle JCP. He has developed Go language based blockchain solutions in retail, education, banking, and financial services sectors. These blockchain solutions were based on Chain Core (Go language based), Ethereum and Hyperledger blockchain platforms. He has experience in building high transactional applications using Java, C, C++, C#, Python, Go, Ruby and JavaScript frameworks. He has reviewed books such as Beyond Software Architecture-Creating and sustaining winning solutions by Luke Hohmann and Algorithms of the intelligent Web by Dr. Haralambos (Babis) Marmanis.
Read more about Bhagvan Kommadi