主页 > 知识库 > golang slice元素去重操作

golang slice元素去重操作

热门标签:AI电销 服务外包 地方门户网站 网站排名优化 铁路电话系统 Linux服务器 呼叫中心市场需求 百度竞价排名

合并两个整型切片,返回没有重复元素的切片,有两种去重策略

1. 通过双重循环来过滤重复元素(时间换空间)

// 通过两重循环过滤重复元素
func RemoveRepByLoop(slc []int) []int {
    result := []int{}  // 存放结果
    for i := range slc{
        flag := true
        for j := range result{
            if slc[i] == result[j] {
                flag = false  // 存在重复元素,标识为false
                break
            }
        }
        if flag {  // 标识为false,不添加进结果
            result = append(result, slc[i])
        }
    }
    return result
}

2. 通过字典来过滤(空间换时间)

因为字典的主键唯一,所以可以用来判断元素是否重复

// 通过map主键唯一的特性过滤重复元素
func RemoveRepByMap(slc []int) []int {
    result := []int{}
    tempMap := map[int]byte{}  // 存放不重复主键
    for _, e := range slc{
        l := len(tempMap)
        tempMap[e] = 0
        if len(tempMap) != l{  // 加入map后,map长度变化,则元素不重复
            result = append(result, e)
        }
    }
    return result
}

ps : 这里为了节省内存,使用map[int]byte。 因为map的value并没有用到,所以什么类型都可以。

效率第一,如果节省计算时间,则可以采用如下方式

// 元素去重
func RemoveRep(slc []int) []int{
    if len(slc)  1024 {
        // 切片长度小于1024的时候,循环来过滤
        return RemoveRepByLoop(slc)
    }else{
        // 大于的时候,通过map来过滤
        return RemoveRepByMap(slc)
    }
}

ps:1024 这个数字不是特别精准,我是使用go test 的基准测试,手工的比较的。

大约在这个数量超上,使用map方式的速度要快,小于这个数量级后,loop方式要快,而且省内存。

补充:Golang数组去重切片去重

方法一:

定义一个新切片(数组),存放原数组的第一个元素,然后将新切片(数组)与原切片(数组)的元素一一对比,如果不同则存放在新切片(数组)中。

package main
import "fmt"
func main() {
    var arr = []string{"hello", "hi", "world", "hi", "china", "hello", "hi"}
    fmt.Println(RemoveRepeatedElement(arr))
}
func RemoveRepeatedElement(arr []string) (newArr []string) {
    newArr = make([]string, 0)
    for i := 0; i  len(arr); i++ {
        repeat := false
        for j := i + 1; j  len(arr); j++ {
            if arr[i] == arr[j] {
                repeat = true
                break
            }
        }
        if !repeat {
            newArr = append(newArr, arr[i])
        }
    }
    return
}

方法二:

先将原切片(数组)进行排序,在将相邻的元素进行比较,如果不同则存放在新切片(数组)中。

package main
import "fmt"
func main() {
    var arr = []string{"hello", "hi", "world", "hi", "china", "hello", "hi"}
    fmt.Println(RemoveRepeatedElement(arr))
}
func RemoveRepeatedElement(arr []string) (newArr []string) {
    newArr = make([]string, 0)
    sort.Strings(arr)
    for i := 0; i  len(arr); i++ {
        repeat := false
        for j := i + 1; j  len(arr); j++ {
            if arr[i] == arr[j] {
                repeat = true
                break
            }
        }
        if !repeat {
            newArr = append(newArr, arr[i])
        }
    }
    return
}

上面两种方法,第一种的效率要高于第二种的。

可以通过测试比较大的数组来观察两种的执行速度。

例如:

arr := []int{1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1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,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6,7,4,1,1,2,3,5,3,1,5,6}

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。如有错误或未考虑完全的地方,望不吝赐教。

您可能感兴趣的文章:
  • golang跳转语句goto,break,continue的使用及区别说明
  • 对Golang中的FORM相关字段理解
  • golang 打印error的堆栈信息操作
  • golang中json和struct的使用说明
  • golang coroutine 的等待与死锁用法
  • golang DNS服务器的简单实现操作
  • Golang中interface{}转为数组的操作
  • golang 实现一个负载均衡案例(随机,轮训)
  • golang 实现Location跳转方式

标签:湖南 仙桃 铜川 黄山 崇左 兰州 衡水 湘潭

巨人网络通讯声明:本文标题《golang slice元素去重操作》,本文关键词  ;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 收缩
    • 微信客服
    • 微信二维码
    • 电话咨询

    • 400-1100-266